package com.example.administrator.printoutindemo;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.example.administrator.printoutindemo.adapter.MyFragmentPagerAdapter;
import com.example.administrator.printoutindemo.adapter.ShenPiAdapter;
import com.example.administrator.printoutindemo.bean.DaishenpiListBean;
import com.example.administrator.printoutindemo.fragment.JiageweihuListFragment;
import com.example.administrator.printoutindemo.fragment.LingdaoshenpiListFragment;
import com.example.administrator.printoutindemo.fragment.SenqingpeisongFragment;
import com.example.administrator.printoutindemo.fragment.ShenpifankuiFragment;
import com.example.administrator.printoutindemo.http.HttpManager;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * Created by noc on 2019/4/9.
 */

public class LingdaoShenPiActivity extends AppCompatActivity {
    private List<Fragment> fragments = new ArrayList<Fragment>();
    private ViewPager viewPager;
    private LinearLayout main_goods, main_deal;
    private TextView main_goods_text,main_deal_text;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lingdaojuesezongyemian);
        viewPager= (ViewPager) findViewById(R.id.viewPager);
        main_deal= (LinearLayout) findViewById(R.id.main_deal);
        main_goods= (LinearLayout) findViewById(R.id.main_goods);
        main_goods_text=findViewById(R.id.main_goods_text);
        main_deal_text=findViewById(R.id.main_deal_text);
        main_goods_text.setText("待审核列表");
        main_deal_text.setText("价格补充列表");
        Fragment oneFragment = new LingdaoshenpiListFragment();//待审核列表
        Fragment twoFragment = new JiageweihuListFragment();//价格补充列表;
        fragments.add(oneFragment);
        fragments.add(twoFragment);

        MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), fragments);
        viewPager.setAdapter(adapter);
        viewPager.setOffscreenPageLimit(0);
        viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

            @Override
            public void onPageSelected(int position) {

            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {
            }

            @Override
            public void onPageScrollStateChanged(int arg0) {
            }
        });
        main_deal.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                viewPager.setCurrentItem(1);
            }
        });
        main_goods.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                viewPager.setCurrentItem(0);
            }
        });

//        setContentView(R.layout.lingdaoshenpi);

    }
}
